// Student类
import java.util.ArrayList;
import java.util.List;

public class Student {
    private List<Subject> subjects = new ArrayList<>();

    public void enrollSubject(Subject subject) {
        if (subjects.size() < 5) {
            subjects.add(subject);
            subject.addStudent(this);
        } else {
            System.out.println("每位学生最多只能选修五门课程");
        }
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}
